package com.ruoyi.web.controller.system;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.SysCertificateSchool;
import com.ruoyi.system.domain.SysCertificateTeacher;
import com.ruoyi.system.service.ISysCertificateSchoolService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 柳
 * @Date 2021/5/13
 * @Description TODO
 */
@RestController
@RequestMapping("/system/certificateschool")
public class SysCertificateSchoolController {
    @Autowired
    private ISysCertificateSchoolService iSysCertificateSchoolService;





    @ApiOperation("根据证书id删除学校证书信息")
    @DeleteMapping("/deleteSysCertificateSchool/{certificateid}")
    public AjaxResult deleteSysCertificateSchool(@PathVariable Integer certificateid){
        iSysCertificateSchoolService.deleteSysCertificateSchool(certificateid);
        return AjaxResult.success();
    }


    @ApiOperation("查询所有学校证书信息(含综合查询)")
    @GetMapping("/querySysCertificateSchools")
    public AjaxResult querySysCertificateSchools(SysCertificateSchool sysCertificateSchool){
        if(sysCertificateSchool.getCurrentPage()==null || sysCertificateSchool.getPageSize()==null){
            return AjaxResult.error();
        }
        PageHelper.startPage(sysCertificateSchool.getCurrentPage(),sysCertificateSchool.getPageSize());
        List<SysCertificateSchool> sysCertificateSchoolList = iSysCertificateSchoolService.querySysCertificateSchools(sysCertificateSchool);
        PageInfo<SysCertificateSchool>  pageInfo=new PageInfo<>(sysCertificateSchoolList);

        return AjaxResult.success(pageInfo);
    }







}
